# 聚合限定符示例

这些示例由 [Sum- 图表函数](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/sum.htm#sum) 函数创建，但可以应用于支持集合分析定义和合计限定符的全部图表聚合函数。

研究以下垂直表呈现形式，在选择任一选择项之前描述逻辑状态：

![带 total 限定符的聚合函数示例表格图像](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/Resources/Images/ex_gen_aggregatequal1.png)

示例表：带有 total 限定符的聚合函数

| Month | Group | Sum(Value) | sum(total Value) | sum({1} total Value) |
| --- | --- | --- | --- | --- |
| - | - | 21 | 21 | 21 |
| 1 | A | 1 | 21 | 21 |
| 1 | B | 2 | 21 | 21 |
| 2 | A | 3 | 21 | 21 |
| 2 | B | 4 | 21 | 21 |
| 3 | A | 5 | 21 | 21 |
| 3 | B | 6 | 21 | 21 |

第二和第三维度列的每一行数字都相同。此数字等于第一维度列的计算合计。

现在，我们仅选择第 1 和第 2 月。结果如下所示：

![按月份筛选且带有 total 限定符的聚合函数示例表格图像](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/Resources/Images/ex_gen_aggregatequal2.png)

示例表格：带 total 限定符的聚合函数，按月筛选

| Month (筛选: 1-2) | Group | Sum(Value) | sum(total Value) | sum({1} total Value) |
| --- | --- | --- | --- | --- |
| - | - | 10 | 10 | 21 |
| 1 | A | 1 | 10 | 21 |
| 1 | B | 2 | 10 | 21 |
| 2 | A | 3 | 10 | 21 |
| 2 | B | 4 | 10 | 21 |

第三个表达式（第五列）的结果仍然未改变，因为设置定义会忽略当前选择项。第二个表达式（第四列）有合计限定符，显示新合计 10，仍然等于第一个表达式合计（第三列）。

研究以下垂直表的呈现形式：

![包含所列字段的总限定符示例表格图像](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/Resources/Images/ex_gen_aggregatequal3.png)

示例表：带有列出字段的 Total 限定符

| Month | Group | Sum(Value) | sum(total &lt;Month&gt; Value) | sum(total &lt;Group&gt; Value) |
| --- | --- | --- | --- | --- |
| - | - | 21 | 21 | 21 |
| 1 | A | 1 | 3 | 9 |
| 1 | B | 2 | 3 | 12 |
| 2 | A | 3 | 7 | 9 |
| 2 | B | 4 | 7 | 12 |
| 3 | A | 5 | 11 | 9 |
| 3 | B | 6 | 11 | 12 |

在第三个表达式列 (`sum(total<Month> 
 Val)`) 中，计算每一个月的合计。

在第四个表达式列 (`sum(total<Grp> Val)`) 中，计算每一个月的合计。

[集合分析和集合表达式](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/SetAnalysis/set-analysis-expressions.htm)

[透视表中的行总和](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/NestedAggregations/sum-of-rows-pivot-tables.htm)

[Aggr](https://help.qlik.com/zh-CN/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/aggr.htm "Aggr")